﻿#region zh-CHS 2006 - 2007 DemoSoft 团队 | en 2006 - 2007 DemoSoft Team

//     NOTES
// ---------------
//
// This file is a part of the G.O.S.E(Game Online Server Engine) for .NET.
//
//                 2006-2007 DemoSoft Team
//
//
// First Version : by H.Q.Cai - mailto:caihuanqing@hotmail.com

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as published
 *   by the Free Software Foundation; either version 2.1 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

#region zh-CHS 包含名字空间 | en Include namespace
using System;
#endregion

namespace Demo_G.O.S.E.ServerEngine.Network
{
    #region zh-CHS 事件数据的类 | en EventArgs
    /// <summary>
    /// 数据包处理事件数据
    /// </summary>
    public class PacketInfoEventArgs : EventArgs
    {
        #region zh-CHS 构造和初始化和清理 | en Constructors and Initializers and Dispose
        /// <summary>
        /// 初始化构造
        /// </summary>
        /// <param name="baseWorld"></param>
        /// <param name="strText"></param>
        /// <param name="state"></param>
        public PacketInfoEventArgs( byte[] byteBuffer, long iHeadIndex )
        {
            m_Buffer = byteBuffer;
            m_HeadIndex = iHeadIndex;
        }
        #endregion

        #region zh-CHS 共有属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 数据包的位置
        /// </summary>
        private long m_HeadIndex = 0;
        #endregion
        /// <summary>
        /// 缓冲区数据中有效的数据包的开始位置
        /// </summary>
        public long HeadIndex
        {
            get { return m_HeadIndex; }
            set { m_HeadIndex = value; }
        }

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 字节的数组(缓冲区数据)
        /// </summary>
        private byte[] m_Buffer = null;
        #endregion
        /// <summary>
        /// 缓冲区数据
        /// </summary>
        public byte[] Buffer
        {
            get { return m_Buffer; }
        }

        #endregion
    }
    #endregion

    #region zh-CHS 委托 | en Delegate
    /// <summary>
    /// NetState处理数据的委托
    /// </summary>
    /// <param name="netState"></param>
    public delegate void ProcessReceiveEventHandler( NetState netState );
    /// <summary>
    /// 处理数据包的回调
    /// </summary>
    /// <param name="netState"></param>
    /// <param name="packetReader"></param>
    public delegate void PacketReceiveCallback( NetState netState, PacketReader packetReader );
    /// <summary>
    /// 不清楚的回调
    /// </summary>
    /// <param name="netState"></param>
    /// <returns></returns>
    public delegate bool ThrottlePacketCallback( NetState netState );
    /// <summary>
    /// 创建NetState时的回调
    /// </summary>
    /// <param name="netState"></param>
    public delegate void CreatedNetStateEventHandler( NetState newNetState );
    /// <summary>
    /// 包长度的回调
    /// </summary>
    /// <param name="netState"></param>
    public delegate long PacketLengthEventHandler( PacketInfoEventArgs eventArgs );
    /// <summary>
    /// 包ID的回调
    /// </summary>
    /// <param name="netState"></param>
    public delegate long PacketIDEventHandler( PacketInfoEventArgs eventArgs );
    /// <summary>
    /// NetState连接的回调
    /// </summary>
    /// <param name="netState"></param>
    /// <returns></returns>
    public delegate long ConnectedNetStateEventHandler( NetState netState );
    /// <summary>
    /// NetState断开的回调
    /// </summary>
    public delegate void DisconnectNetStateEventHandler( NetState netState );
    #endregion
}
#endregion

